表示仿射变换:一组系数a,b,c,d,用于将形式(x,y)的点变换为(a*x+b,c*y+d)并进行相反的变换。由Leaflet在其投影代码中使用。
Usage example
var transformation = L.transformation(2, 5, -1, 10),
p = L.point(1, 2),
p2 = transformation.transform(p), // L.point(7, 8)
p3 = transformation.untransform(p2); // L.point(1, 2)
Creation
Factory | Description |
---|---|
L.transformation(<Number> a, <Number> b, <Number> c, <Number> d) | Instantiates a Transformation object with the given coefficients. 使用给定的系数实例化Transformation对象。 |
L.transformation(<Array> coefficients) | Expects an coefficients array of the form [a: Number, b: Number, c: Number, d: Number] .应为[a:Number,b:Number,c:Number,d:Number]形式的系数数组。 |
Methods
Method | Returns | Description |
---|---|---|
transform(<Point> point, <Number> scale?) | Point | Returns a transformed point, optionally multiplied by the given scale. Only accepts actual L.Point instances, not arrays.返回变换后的点,可以选择乘以给定的比例。仅接受实际L。点实例,而不是数组。 |
untransform(<Point> point, <Number> scale?) | Point | Returns the reverse transformation of the given point, optionally divided by the given scale. Only accepts actual L.Point instances, not arrays.返回给定点的反向变换,可以选择除以给定比例。仅接受实际L。点实例,而不是数组。 |